//
//  PatientUtil.m
//  deerkids
//
//  Created by 王昭的Mac Air on 2017/10/20.
//  Copyright © 2017年 wangzhao. All rights reserved.
//

#import "PatientUtil.h"

#define PatientPath  [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"patient.archive"]

@implementation PatientUtil

//患者信息存储
+ (BOOL)savePatient:(Patient *)patient
{
    return [NSKeyedArchiver archiveRootObject:patient toFile:PatientPath];
}

//患者信息获取
+ (Patient *)getPatient
{
    return [NSKeyedUnarchiver unarchiveObjectWithFile:PatientPath];
}

//患者信息删除
+ (BOOL)deletePatient
{
    return [[NSFileManager defaultManager] removeItemAtPath:PatientPath error:nil];
}

@end
